Skip to content

feat: switch to yeoman-env - #71

Merged
jannyHou merged 1 commit into
masterfrom
update/yeoman
Nov 14, 2018
Merged

feat: switch to yeoman-env#71
jannyHou merged 1 commit into
masterfrom
update/yeoman

Conversation

@jannyHou

@jannyHou jannyHou commented Aug 1, 2018

Copy link
Copy Markdown
Contributor

Description

The follow up PR of strongloop/generator-loopback#363, please make sure the generator-loopback PR get merged first and a new major version of it is released.

Related issues

strongloop/generator-loopback#355

Checklist

  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style
    guide

Comment thread package.json Outdated
"camelcase-keys": "^4.0.0",
"debug": "^2.6.1",
"generator-loopback": "^5.5.1",
"generator-loopback": "file:../generator-loopback",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temporarily points to a local module. This PR will merge after we release a new major version for generator-loopback.

@bajtos bajtos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me 👍

Please run the CLI manually to check that we are correctly setting up options and arguments, there have been issues with this integration point in the past.

Things to try:

  • lb app foobar - picks foobar as the app name
  • lb model --bluemix - understands that bluemix option was set and returns error "datasources-config.json not found"

Comment thread bin/loopback-cli.js

debug('env.run %j %j', args, options);
env.run(args, options);
env.lookup(function() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is env.lookup allowed to fail? Should we add error-handling code to the callback? I am not familiar with this Yeoman API, just asking.

env.lookup(function(err) {
  if (err) {
    // handle the error and exit (?)
  }

  debug('changing directory back to %s', cwd);
  // etc.
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, while the implementation of lookup(cb) always returns cb(null), see code. It looks like a problem of yeoman-environment, it doesn't propagate the error got from this._tryRegistering.

Anyway I am adding the err check :)

@jannyHou

jannyHou commented Aug 2, 2018

Copy link
Copy Markdown
Contributor Author

@bajtos Thanks for the review and suggestion!

Please run the CLI manually to check that we are correctly setting up options and arguments, there have been issues with this integration point in the past.

Sure 👍The PR is written when I invoke the generator by lb *.
And it's good to know the use cases of the manual verifications.

@jannyHou jannyHou changed the title [do NOT merge before generator-loopback get updated]feat: switch to yeoman-env feat: switch to yeoman-env Sep 6, 2018
Comment thread package.json
{
"name": "loopback-cli",
"version": "4.2.0",
"version": "5.0.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this to prevent tests breaking downstream?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for replying late 🙈

prevent tests breaking downstream

Exactly.

Comment thread bin/loopback-cli.js Outdated
const lbGenerator = require('generator-loopback');
const yeoman = lbGenerator._yeoman; // generator-loopback should export _yeoman
assert(yeoman, 'generator-loopback should export _yeoman');
const yeomanEnv = lbGenerator._yeomanEnv; // generator-loopback should export _yeomanEnv

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: I don't think this comment is needed considering the assert on the next line

@hacksparrow hacksparrow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the Taranveer and Miroslav's points addressed, this LGTM.

@jannyHou

Copy link
Copy Markdown
Contributor Author

FYI, the jenkins machines seem don't install the latest generator-loopback. They all fail with the one test that's been fixed in generator-loopback@6.0.1

Travis tests all pass.

I would like to merge this PR then create another PR to fix the jenkins error.

@b-admike b-admike left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@b-admike

Copy link
Copy Markdown
Member

FYI, the jenkins machines seem don't install the latest generator-loopback. They all fail with the one test that's been fixed in generator-loopback@6.0.1

Travis tests all pass.

I would like to merge this PR then create another PR to fix the jenkins error.

Perhaps @rmg would know better / how to remove it if npm used a cached version of the module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants